const FdoNotificationsIface = loadInterfaceXML('org.freedesktop.Notifications');
+const NOTIFICATION_SERIALIZED_NAME = 'notifications';
+const NOTIFICATION_SERIALIZED_FORMAT = 'a(sa(sv))';
+
/** @enum {number} */
const NotificationClosedReason = {
EXPIRED: 1,
this._isLoading = true;
try {
- const value = global.get_persistent_state('a(sa(sv))', 'notifications');
+ const value = global.get_persistent_state(
+ NOTIFICATION_SERIALIZED_FORMAT,
+ NOTIFICATION_SERIALIZED_NAME);
+
if (value) {
const sources = value.deepUnpack();
sources.forEach(([appId, notifications]) => {
sources.push(source.serialize());
}
- global.set_persistent_state('notifications', new GLib.Variant('a(sa(sv))', sources));
+ global.set_persistent_state(NOTIFICATION_SERIALIZED_NAME,
+ new GLib.Variant(NOTIFICATION_SERIALIZED_FORMAT, sources));
}
AddNotificationAsync(params, invocation) {